package com.cc.blog.admin.controller;

import com.cc.blog.admin.domain.dto.UpdateBlogSettingsReqDTO;
import com.cc.blog.admin.service.AdminBlogSettingsService;
import com.cc.blog.common.annotation.ApiOperationLog;
import com.cc.blog.common.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author cc
 * @Date 2024/7/11 10:11
 */
@RestController
@RequestMapping("/admin/blog/settings")
@Api(tags = "Admin 博客设置模块")
@AllArgsConstructor
public class AdminBlogSettingsController {

    private final AdminBlogSettingsService blogSettingsService;

    @PostMapping("/update")
    @ApiOperation(value = "博客基础信息修改")
    @ApiOperationLog(description = "博客基础信息修改")
    public Result updateBlogSettings(@RequestBody @Validated UpdateBlogSettingsReqDTO updateBlogSettingsReqDTO) {
        return blogSettingsService.updateBlogSettings(updateBlogSettingsReqDTO);
    }

    @PostMapping("/detail")
    @ApiOperation(value = "获取博客设置详情")
    @ApiOperationLog(description = "获取博客设置详情")
    public Result findDetail() {
        return blogSettingsService.findDetail();
    }
}
